package novel.common.test;

import java.util.concurrent.BlockingQueue;

/**
 * Created by sutong on 2017/10/24.
 */
public class ProducerQueue implements Runnable {
    private final BlockingQueue queue;
    public ProducerQueue(BlockingQueue queue){
        this.queue=queue;
    }
    @Override
    public void run() {
        for (int i = 0; i < 10; i++) {
            System.out.println("生产者生产的苹果编号："+i);
            try {
                queue.put(i);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
